<template>
  <div class="home">
    <Header></Header>
    <transition :name="transtionSlide"
      :enter-active-class="'slide-active'"
      :leave-active-class="'slide-active'"
      mode="out-in">
      <keep-alive>
        <!-- <navigation> -->
        <router-view></router-view>
        <!-- </navigation> -->
      </keep-alive>
    </transition>
  </div>
</template>

<script>
// @ is an alias to /src
import Header from '../components/Header.vue'
export default {
  name: 'home',
  data() {
    return {
      navIndex: 0,
      transtionSlide: 'slide-left'
    }
  },
  components: {
    Header
  },
  computed: {},
  methods: {},
  created() {
    this.$navigation.on('forward', () => {
      this.transtionSlide = 'slide-left'
    })
    this.$navigation.on('back', () => {
      this.transtionSlide = 'slide-right'
    })
  },
  mounted() {}
}
</script>
<style lang="scss" scoped>
.home {
  width: 100%;
  background: #f9fafd;
}
.slide-active {
  transition: 0.3s cubic-bezier(0.55, 0, 0.1, 1);
  transition-property: opacity, transform;
}
.slide-left-enter,
.slide-right-leave-to {
  opacity: 0;
  transform: translate3d(30%, 0, 0);
}
.slide-left-leave-to,
.slide-right-enter {
  opacity: 0;
  transform: translate3d(-30%, 0, 0);
}
</style>
